package ar.republicagroup.gestion.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author DIEGOALV
 */
@Entity
@Table(name = "cheque_penalizacion")
@NamedQueries({
    @NamedQuery(name = "ChequePenalizacion.findAll", query = "SELECT c FROM ChequePenalizacion c")})
public class ChequePenalizacion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "comision")
    private double comision;
    @Basic(optional = false)
    @Column(name = "estado")
    private int estado;
    @JoinColumn(name = "cheque_estado_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private ChequeEstado chequeEstadoId;

    public ChequePenalizacion() {
    }

    public ChequePenalizacion(Integer id) {
        this.id = id;
    }

    public ChequePenalizacion(Integer id, double comision, int estado) {
        this.id = id;
        this.comision = comision;
        this.estado = estado;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public double getComision() {
        return comision;
    }

    public void setComision(double comision) {
        this.comision = comision;
    }

    public int getEstado() {
        return estado;
    }

    public void setEstado(int estado) {
        this.estado = estado;
    }

    public ChequeEstado getChequeEstadoId() {
        return chequeEstadoId;
    }

    public void setChequeEstadoId(ChequeEstado chequeEstadoId) {
        this.chequeEstadoId = chequeEstadoId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ChequePenalizacion)) {
            return false;
        }
        ChequePenalizacion other = (ChequePenalizacion) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return getChequeEstadoId().getNombre();
    }
    
}
